﻿#region

using AspectCore.DynamicProxy.Parameters;
using Vin.Tool.Core.AssertCategory;

#endregion

namespace Vin.Extension.Aop.Attributes.Parameter;

/// <summary>
/// 方法需要是虚方法（virtual）或者接口方法（interface）才能被拦截
/// </summary>
public class ValidAttribute : VinBaseParameterInterceptorAttribute
{
    public override Task Invoke(ParameterAspectContext context, ParameterAspectDelegate next)
    {
        ValidatorTool.TryValidateObject(context.Parameter.Value);
        return next(context);
    }
}